﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace cnFederal.Controls
{
    public partial class NewsStripCtrl : System.Web.UI.UserControl
    {
        List<FaPost> _postList;
        int _pager;
          public NewsStripCtrl()
        {
            FaPosts.Load();
            _postList = FaPosts.GetTopNews(10);
            _pager = 0;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ASPxImageSlider1.DataSource = _postList;
            ASPxImageSlider1.DataBind();
            int i = 0;
            foreach (var s in _postList)
            {
                ASPxImageSlider1.Items[i].NavigateUrl = Common.GetAbsoluteUri( @"~/Fa-Forms/SelectedContent.aspx?Id="+s.Id);
                ASPxImageSlider1.Items[i++].Text = s.Title;
                
            }
            //ListViewStrip.DataSource = _postList;
            //ListViewStrip.DataBind();
        }
        //protected void pagerStrip_click(object sender, EventArgs e)
        //{

        //    int lastpage = this.DataPagerStrip.StartRowIndex;

        //    DataPagerStrip.SetPageProperties(lastpage, DataPagerStrip.MaximumRows, false);
        //    ListViewStrip.DataBind();
        //}
        
        //private void Paging()
        //{
        //    if(_pager == 0)
        //    _pager = this.DataPagerStrip.StartRowIndex;
        //    if (_pager  == DataPagerStrip.TotalRowCount -1)
        //        _pager = 0;
        //    else
        //        _pager++;
                
        //    DataPagerStrip.SetPageProperties(_pager, DataPagerStrip.MaximumRows, false);
            
        //    ListViewStrip.DataBind();
        //}
        //protected void UpdateTimer_Tick(object sender, EventArgs e)
        //{
           
        //    Paging();
        //}
    }
}